#pragma once
#include "Helper.h"

class Node;

class ParseTree
{
    ParseTree* firstChild;
    ParseTree* lastChild;
    ParseTree* nextSibling;

    void (*typeCheckFunc) (ParseTree*);
    void (*makeCodeFunc ) (ParseTree*);

    int objectID;
    int nrOfChilds;
    static int nextObjectID;

protected:
    TType type;

public:
    ParseTree();
    virtual ~ParseTree();

    //Parsing and Typechecking:
    virtual void setNextSibling(ParseTree* nextSibling);
    virtual ParseTree* getNextSibling();
    virtual ParseTree* getFirstChild();
  
    virtual void add_node(ParseTree* node);
    virtual void create(void (*typeCheckFunc) (ParseTree*), void (*makeCodeFunc) (ParseTree*));
    virtual void typeCheck();
    virtual TType getType();
    virtual void setType(TType type);

    //MAKE CODE:
    virtual void makeCode();
};
